import http from '@/ubtils/request'

//获取购物车列表
export function getCartList(userid) {
  return http({
    url: '/api/cart/list',
    method: 'post',
    data: { userid },
  })
}

//加入购物车
export function addCart(userid, proid, num) {
  return http({
    url: '/api/cart/add',
    method: 'post',
    data: {
      userid,
      proid,
      num,
    },
  })
}

//更新购物车数量
export function updateCartNum(cartid, num) {
  return http({
    url: '/api/cart/updatenum',
    method: 'post',
    data: { cartid, num },
  })
}

//更新当前购物车数据的选中状态
export function updateCartSelect(cartid, flag) {
  return http({
    url: 'api/cart/selectone',
    method: 'post',
    data: { cartid, flag },
  })
}
